<cfcomponent extends="queries">
	
	<!---TODO:  Change this funky code--->
    <cffunction name="funcGetPositionDetails" access="remote" returntype="any">
		<cfargument name="PosID" required="yes" />
		<cfargument name="Field" default="JobCode" type="string"/>
		
        <cfswitch expression="#trim(ARGUMENTS.Field)#">
            <cfcase value="JobTitle">
                <cfset ARGUMENTS.Field = "JobCodeDescription">
            </cfcase>
            <cfcase value="HoursPerYear">
                <cfset ARGUMENTS.Field = "StandardUnitsPerYear">
            </cfcase>
            <cfcase value="SCF_UDF1">
                <cfset ARGUMENTS.Field = "PositionCodeUserDefined1">
            </cfcase>
            <cfcase value="SCF_UDF2">
                <cfset ARGUMENTS.Field = "PositionCodeUserDefined2">
            </cfcase>
            <cfcase value="SCF_UDF3">
                <cfset ARGUMENTS.Field = "PositionCodeUserDefined3">
            </cfcase>
            <cfcase value="WorkersCompCode">
                <cfset ARGUMENTS.Field = "PositionCodeUserDefined4">
            </cfcase>     
            <cfdefaultcase> 
                <cfset ARGUMENTS.Field = ARGUMENTS.Field>
            </cfdefaultcase>         
        </cfswitch>
        		
		<cfset qryGetPositionInfo = SUPER.funcGetPositionCode(ARGUMENTS.PosID) />

		<cfset retVal = qryGetPositionInfo[ARGUMENTS.Field]> 
        
		<cfreturn qryGetPositionInfo />
	</cffunction>
	<!---TODO:  Change this funky code---> 
    
    
    
    <!--- Get Workers Comp ID --->
    <cffunction name="funcGetWorkersCompID" access="remote" returntype="any">    
		<cfargument name="WCCode" required="yes"  />
        
        <cfquery name="qryGetWorkersCompID" datasource="#Session.DataSourceWFCDB#">
            Select 
            	WorkersCompensationIDNo
            From 
            	tWCMP_Workers_Compensation_Codes
            Where 
            	WorkersCompensationCode = <cfqueryparam cfsqltype="cf_sql_varchar" value="#ARGUMENTS.WCCode#" />
        </cfquery>
        
		<cfreturn qryGetWorkersCompID.WorkersCompensationIDNo />
    </cffunction>
    <!--- Get Workers Comp ID --->
        
    
    
    <!--- Get Expiration Date --->
    <cffunction name="funcTestExpirationDate" access="remote" returntype="any">    
		<cfargument name="Date" required="yes" type="date"  />
        
        <cfif dateFormat(ARGUMENTS.Date) LTE dateadd('m',6,now())>
        	<Cfset LOCALS.ExpirationDate = True />
        <cfelse>
        	<Cfset LOCALS.ExpirationDate = False />
        </cfif>
        
		<cfreturn LOCALS.ExpirationDate />
    </cffunction>
    <!--- Get Expiration Date --->
    
    
    
    <!--- Get Export Directory --->
    <cffunction name="funcCheckEmailExport" access="remote" returntype="any">
        <cfargument name="Directory" required="yes" type="string"  />   
        <cfargument name="Login" required="yes" type="string"  />
        <cfdirectory directory="#ARGUMENTS.Directory#" name='searchDirectory' action="list" />
        <cfquery dbtype="query" name="search">
		  SELECT * FROM searchDirectory WHERE Name like '%#ARGUMENTS.Login#%'
		</cfquery>
        <Cfset EmailDir = ARGUMENTS.Directory & '\' & search.Name & '\Email\' />
        <cfdirectory directory="#EmailDir#" name='email' action="list" filter="*.pst" />
        <Cfreturn email />
    </cffunction>
    <!--- Get Export Directory --->
    
    
    
    <!--- Get Check Rosetta Disabled --->
    <cffunction name="funcCheckRosetta" access="remote" returntype="any">
        <cfargument name="RosettaID" required="yes" type="string"  />
        <cfquery name="qryCheckRosetta" datasource="#Session.DataSourceRosetta#">
            SELECT * FROM RosettaStone 
            WHERE RosettaID = <cfqueryparam cfsqltype="cf_sql_integer" value="#ARGUMENTS.RosettaID#" /> AND Disabled = 1
        </cfquery>
        <Cfreturn qryCheckRosetta />
    </cffunction>
    <!--- Get Check Rosetta Disabled --->
    
    
    
    <!--- Get Check Archived OU --->
    <cffunction name="funcCheckArchivedOU" access="remote" returntype="any">
        <cfargument name="FirstName" required="yes" type="string"  />
        <cfargument name="LastName" required="yes" type="string"  />
        <cftry>
	        <cfset ArchivedUserDN = "CN=" & Trim(ARGUMENTS.LastName) & '\, ' & Trim(ARGUMENTS.FirstName) & ',OU=Archived_Users,OU=SCF,OU=SCFUsers,DC=SouthcentralFoundation,DC=com'  />
	        <cfldap action="QUERY" name="ldapAttr" server="10.100.1.101"
	            start="#ArchivedUserDN#" username="scf\ExchDev" password="Password20!"
	            attributes="displayName,manager,member,distinguishedName" />
	        <cfreturn ldapAttr.RecordCount />
        <cfcatch type='any'>
            <cfreturn 0 />
        </cfcatch>
        </cftry>
    </cffunction>
    <!--- Get Check Archived OU --->
    
          
</cfcomponent>